# DSL CombineRule {62&63|64|{65&66}} match (list(62,21,14))  
# ==>false
# attention:hasnt deal with error inputs. reload some methods

Rule := Object clone;
Rule geneComb := method(b, opra, 
    if(b proto == Number,
        r2 := newSimpleRule(b),
        r2 := b);
    newCombineRule(opra, call target, r2));
Rule & := method(b, geneComb(b, "and"));
Rule | := method(b, geneComb(b, "or"));

SimpleRule := Rule clone;
Rule newSimpleRule := method(id, 
    r := SimpleRule clone; 
    r tid := id;
    r match := method(ls, ls contains(tid));
    r);

CombineRule := Rule clone;
Rule newCombineRule := method(opra, r1, r2, 
    r := CombineRule clone;
    r op := opra;
    r rule1 := r1;
    r rule2 := r2;
    r match := method(ls,
            rule1 match(ls) doString(op .. "(" .. rule2 match(ls) .. ")")
        );
    r);

Number geneComb := method(b, opra, 
    r1 := Rule newSimpleRule(call target);
    if(b proto == Number,
        r2 := Rule newSimpleRule(b),
        r2 := b);
    Rule newCombineRule(opra, r1, r2));
Number & := method(b, geneComb(b, "and"));
Number | := method(b, geneComb(b, "or"));

curlyBrackets := method(arg, if(arg proto == Number,
    Rule newSimpleRule(arg), arg)
);

# SimpleRule tid ::= nil;
# SimpleRule match := nil; 
# CombineRule rule1 ::= nil;
# CombineRule rule2 ::= nil;
# CombineRule op ::= nil;
# CombineRule match := nil;
